package com.chong.method;

public class Demo5 {
    public static void main(String[] args) {
        printMax(1, 2, 56, 36.3, 89.6);
        printMax(new double[]{1, 12.3, 86.3, 654.2, 89});
    }

    public static void printMax(double... numbers) {
        if (numbers.length == 0) {
            System.out.println("No argument passed");
            return;
        }

        double result = numbers[0];
        //排序
        for (int i = 1; i < numbers.length; i++) {
            if (numbers[i] > result) {
                result = numbers[i];
            }
        }

        System.out.println("This max value is:" + result);
    }
}
